﻿using UnityEngine;
using System.Collections;

public class FindChild : MonoBehaviour {

    public static Transform FindInAllChilds(Transform t_trans, string name)
    {
        Transform tempChild = t_trans.FindChild(name);

        if (tempChild == null)
        {
            for (int i = 0; i < t_trans.childCount; i++)
            {
                tempChild = FindInAllChilds(t_trans.GetChild(i), name);

                if (tempChild != null)
                    break;
            }
        }

        return tempChild;
    }
}
